package com.topisv.tms.repository.sms;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.topisv.tms.entity.sms.SmsRequest;

public abstract interface SmsRequestDao extends PagingAndSortingRepository<SmsRequest, Long>, JpaSpecificationExecutor<SmsRequest>
{

	@Query("select t from SmsRequest t where t.customerCode=?")
	List<SmsRequest> loadByCusteomerCode(String customerCode);

	@Query("select t from SmsRequest t where t.customerCode=? and t.status=1")
	List<SmsRequest> loadHandingByCustomerCode(String customerCode);

	@Query("select t from SmsRequest t where t.status=1 and t.requestType='1' order by t.id desc")
	List<SmsRequest> loadForKTAudit();

	@Query("select t from SmsRequest t where t.status=1 and t.requestType='2' order by t.id desc")
	List<SmsRequest> loadForCZAudit();

	@Query("select t from SmsRequest t where t.status=1 and t.requestType='3' order by t.id desc")
	List<SmsRequest> loadForJDAudit();

	@Query("select t from SmsRequest t where t.status<>1 order by t.id desc")
	List<SmsRequest> loadForAuditLog();

	@Query("select t from SmsRequest t where t.customerCode=?1 and t.requestType=?2  order by t.id desc")
	List<SmsRequest> loadByCondition(String customerCode, String type);

}